brand()
function brand (){

function getUrlParams() {
    let href = location.href;
    let regExp = /.+\?(.+)/
    
    let param = regExp.exec(href)
    if(!param){
        return
    }
    
    param = param[1]
        // console.log(param);
        // console.log(decodeURI(param))
    let paramArr = param.split("&");
    // console.log(paramArr);
    let query = {}
    paramArr.forEach(item => {
        let itemArr = item.split("=");
        // console.log(itemArr);
        query[itemArr[0]] = decodeURI(itemArr[1])
    })

    return query
}

let query = getUrlParams()
// console.log(query);
// console.log(query.brandName);

let shopNavTitle =document.getElementById('shopNavTitle')
let rmm = document.querySelector('.recommen-main-content')
console.log(document.querySelector('.recommen-main-content'));
shopNavTitle.innerText=query.brandName

ajax({
    url:'http://chst.vip:1234/api/getbrandproductlist',
    data:{
        brandtitleid:query.brandtitleid
    }
}).then(res=>{
    res =res.result
    // console.log(res);
    renderBrand(res)
})

function renderBrand (res){

    let html ='';
    for(let i=0;i<res.length;i++){
        html += `
        <div class="shop-jump" productId="${res[i].productId}" brandName=${res[i].brandName}>
          <div>
            ${res[i].productImg}
          </div>
          <div>

            <p>
            ${res[i].productName}
            </p>
  
            <p>
              ${res[i].productPrice}
            </p>
  
            <p>
              <span>${res[i].productQuote}</span>
              &nbsp;&nbsp;&nbsp;
              <span>${res[i].productCom}</span>
           </p>
          </div>
      </div>
        `
    }
    
    document.querySelector('.recommen-main-content').innerHTML=html

    let recMain = document.querySelector('.recommen-main-content')
    let recMainChild =recMain.children
    console.log(recMainChild);
    for(let k =0;k<recMainChild.length;k++){
        recMainChild[k].onclick=function(){
        let productId =recMainChild[k].getAttribute('productId')
            // console.log(productId);
        let brandName=recMainChild[k].getAttribute('brandName')
        // console.log(brandName);

            location.href=`productlist.html?productId=${productId}&brandName=${brandName}`
        }
    }


}

}
